package java67_5;

import java.util.Scanner;

public class Avg5_2 {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		double sum = 0, k = 0;

		System.out.println("请输入姓名:");
		String name = in.next();
		int i = 1;/// !!!!!@
		for (; i <= 5; i++) {
			System.out.print("请输入第" + i + "门课成绩:");
			k = in.nextDouble();
			if (k < 0) {

				break;
			}
			sum += k;
		}
		// 无法区分是正常循环结束还是提前结束的
		if (i > 5) {
			double avg = sum / 5;
			System.out.println(name + "的平均分是:" + avg);

		} else {
			System.out.println("输入错误");
		}
	}

}
